// 入库相关API
window.stockInAPI = {
    // 获取入库记录
    getStockInRecords: async (params = {}) => {
        try {
            const response = await apiClient.get('/api/stock-in/', { params });
            return response;
        } catch (error) {
            console.error('获取入库记录失败:', error);
            throw error;
        }
    },
    
    // 获取入库记录详情
    getStockInRecord: async (id) => {
        try {
            const response = await apiClient.get(`/api/stock-in/${id}`);
            return response;
        } catch (error) {
            console.error('获取入库记录详情失败:', error);
            throw error;
        }
    },
    
    // 创建入库记录
    createStockInRecord: async (data) => {
        try {
            const response = await apiClient.post('/api/stock-in/', data);
            return response;
        } catch (error) {
            console.error('创建入库记录失败:', error);
            throw error;
        }
    },
    
    // 更新入库记录
    updateStockInRecord: async (id, data) => {
        try {
            const response = await apiClient.put(`/api/stock-in/${id}`, data);
            return response;
        } catch (error) {
            console.error('更新入库记录失败:', error);
            throw error;
        }
    },
    
    // 删除入库记录
    deleteStockInRecord: async (id) => {
        try {
            const response = await apiClient.delete(`/api/stock-in/${id}`);
            return response;
        } catch (error) {
            console.error('删除入库记录失败:', error);
            throw error;
        }
    },
    
    // 获取入库统计
    getStatistics: async (params = {}) => {
        try {
            const response = await apiClient.get('/api/stock-in/statistics', { params });
            return response;
        } catch (error) {
            console.error('获取入库统计失败:', error);
            throw error;
        }
    }
};
